package javaTeste.tSe;

import java.Condicao;
import java.bloco.Se;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;



public class TesteBlocoSe implements Especificacao {
	Se aguaLimpa = null;

	@Before
	public void up() {
		aguaLimpa = new Se(new Condicao("agua==limpa"));
	}

	@Test
	public void seCondicaoAguaLimpa() {
		Assert.assertEquals("if(agua==limpa){}", aguaLimpa.codigoFonte());

	}

	@Test
	public void seCondicaoAguaLimpaSenaoB() {
		aguaLimpa.setSenao("b");
		Assert.assertEquals("if(agua==limpa){}else{b}", aguaLimpa.codigoFonte());
	}

	@Test
	public void seCondicaoAguaLimpaVariavelINTa() {
		aguaLimpa.setLogica("int a");
		Assert.assertEquals("if(agua==limpa){int a}", aguaLimpa.codigoFonte());

	}

	@Test
	public void seCondicaoAguaLimpaelseifA_BSenao() {
		aguaLimpa.setSenao("b");
		aguaLimpa.addSenaoSe(new Condicao("a"),"");
		aguaLimpa.addSenaoSe(new Condicao("b"),"");
		Assert.assertEquals("if(agua==limpa){}else if(a){}else if(b){}else{b}",
				aguaLimpa.codigoFonte());
	}

}